package io.renren.modules.mark.controller;

import java.util.Arrays;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import io.renren.modules.mark.entity.MarkDatasetUserEntity;
import io.renren.modules.mark.service.MarkDatasetUserService;
import io.renren.common.utils.PageUtils;
import io.renren.common.utils.R;



/**
 * 
 *
 * @author 
 * @email 
 * @date
 */
@RestController
@RequestMapping("mark/markdatasetuser")
public class MarkDatasetUserController {
    @Autowired
    private MarkDatasetUserService markDatasetUserService;

    /**
     * 列表
     */
    @RequestMapping("/list")
    //@RequiresPermissions("mark:markdatasetuser:list")
    public R list(@RequestParam Map<String, Object> params){
        PageUtils page = markDatasetUserService.queryPage(params);

        return R.ok().put("page", page);
    }


    /**
     * 信息
     */
    @RequestMapping("/info/{itemId}")
    //@RequiresPermissions("mark:markdatasetuser:info")
    public R info(@PathVariable("itemId") String itemId){
		MarkDatasetUserEntity markDatasetUser = markDatasetUserService.getById(itemId);

        return R.ok().put("markDatasetUser", markDatasetUser);
    }

    /**
     * 保存
     */
    @RequestMapping("/save")
    //@RequiresPermissions("mark:markdatasetuser:save")
    public R save(@RequestBody MarkDatasetUserEntity markDatasetUser){
		markDatasetUserService.save(markDatasetUser);

        return R.ok();
    }

    /**
     * 修改
     */
    @RequestMapping("/update")
    //@RequiresPermissions("mark:markdatasetuser:update")
    public R update(@RequestBody MarkDatasetUserEntity markDatasetUser){
		markDatasetUserService.updateById(markDatasetUser);

        return R.ok();
    }

    /**
     * 删除
     */
    @RequestMapping("/delete")
    //@RequiresPermissions("mark:markdatasetuser:delete")
    public R delete(@RequestBody String[] itemIds){
		markDatasetUserService.removeByIds(Arrays.asList(itemIds));

        return R.ok();
    }

}
